package com.brillilab.dao.mapper.kit;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.brillilab.domain.po.kit.KitUsage;
import com.brillilab.domain.vo.home.HomeChartVo;
import com.brillilab.domain.vo.kit.DeviceUnlock;
import com.brillilab.domain.vo.kit.KitUsageVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 取用清单/待归还清单表 Mapper 接口
 * </p>
 *
 * @author WuMenghao
 * @since 2018-11-19
 */
public interface KitUsageMapper extends BaseMapper<KitUsage> {

    Integer saveTakeList(List<KitUsage> list);

    List<KitUsageVo> selectKitUsageVoList(@Param("labId") Long labId,@Param("labMemberId") Long labMemberId,@Param("states") Integer... states);

    Integer updateBatch(@Param("kitUsages") List<KitUsage> kitUsages);

    Integer selectKitUsageCount(@Param("isExperiment") boolean isExperiment,@Param("labId") Long labId,@Param("labMemberId") Long labMemberId,@Param("experimentId") Long experimentId,@Param("states") Integer... states);

    List<KitUsage> selectListInOneDevice(@Param("deviceId") Long deviceId,@Param("labId") Long labId,@Param("labMemberId") Long labMemberId,@Param("state") Integer state);

    DeviceUnlock selectKitUsageDeviceUnlock(Long usageId);

    String selectKitUserName(Long inventoryId);

    List<DeviceUnlock> selectKitUsageDeviceUnLockList(@Param("ids") List<Long> kitUsageIds);

    List<KitUsageVo> getKitUsageVoList(@Param("ids") List<Long> usageIds,@Param("states") Integer[] states);

    KitUsageVo selectKitUsageVo(@Param("id") Long id);

    List<KitUsage> selectExistList(@Param("labId") Long labId,@Param("labMemberId")Long labMemberId,@Param("states") Integer[] states);

    int setUsageToTakeMiss(@Param("ids") List<Long> notReturnIds);

    int setUsageToReturnMiss(@Param("ids") List<Long> returnedIds);

    List<KitUsageVo> selectHistoryKitUsageVoList(@Param("labId")Long labId,@Param("labMemberId")Long labMemberId);

    int selectHistoryCount(@Param("labId")Long labId,@Param("labMemberId")Long labMemberId);

    int setUsageToNotTakeSuccess(@Param("ids")List<Long> returnedIds);

    int setUsageToNotReturnSuccess(@Param("ids")List<Long> returnedIds);

    List<HomeChartVo> getSevenDaysUsageChart(@Param("labMemberId")Long labMemberId);

	List<KitUsageVo> selectKitUsageListByState(@Param("labMemberId")Long labMemberId,@Param("state") Integer state);

	int selectKitUsageCountByState(@Param("labMemberId")Long labMemberId,@Param("state") Integer state);
}
